<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>MeteoCal - Main Page</title>
	<link rel="stylesheet" type="text/css" href="${request.contextPath}/resources/css/main.css" />
    </h:head>
    <h:body>
        <p:layout fullPage="true">
            <p:layoutUnit position="north" size="60" resizable="false" closable="false" collapsible="false">
		<ui:include src="/includes/header.xhtml"/>
            </p:layoutUnit>
	    <p:layoutUnit position="center" class="content">
<!--		TODO: Add rendering condition to check for news
		<p:outputPanel class="alert-box" rendered="#{request.isUserInRole('admin') or request.isUserInRole('user')}">
		    <h1>EVENT ALERT</h1>
		    <br/>
                     <h:dataTable value="#{inviteeController.myInvitation}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListInviteeTitle_accepted}"/>
                            </f:facet>
                            <h:outputText value="#{item.accepted}"/>
                        </h:column>

                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="event name"/>
                            </f:facet>
                            <h:outputText value="#{item.eventID.eventName}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="event holder}"/>
                            </f:facet>
                            <h:outputText value="#{item.userEmail}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="notification"/>
                            </f:facet>
                            <h:outputText value="#{item.eventID.eventNotification}"/>
                        </h:column>
                
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:form>
                            <h:commandLink action="#{inviteeController.myInvitationEdit}" value="edit"/>
                            <h:commandLink  value="i will not come"/>
                            </h:form>
                        </h:column>
                    </h:dataTable>

		    <ui:repeat var="e" value="#{eventController.items}">
		    <div class="multi-column-container alert">
			INSERT MESSAGES HERE
			TODO: Change outcome of this button to the appropriate event
			<p:button value="Update Event" outcome="login.xhtml" />
		    </div>
		    </ui:repeat>
		    TODO: Remove the following div and its contents
		    <div class="multi-column-container alert">
			INSERT MESSAGES HERE
			TODO: Change outcome of this button to the appropriate event
			<p:button value="Update Event" outcome="login.xhtml" />
		    </div>
		</p:outputPanel>-->
		<h1>Upcoming events</h1>
		<div id="event-container">
		    <ui:repeat var="e" value="#{eventController.newEventList}">
			<div class="event">
			    <h:form>
				<h:commandLink action="#{eventController.newEventPageView}"><h2>#{e.eventName}</h2></h:commandLink>
			    </h:form>
			    <h:outputText value="#{e.eventDate}" title="#{bundle.ViewEventTitle_eventDate}">
				<f:convertDateTime timeZone="GMT+1" pattern="MM/dd/yyyy" />
			    </h:outputText>
			    &nbsp;&nbsp;&nbsp;
			    <h:outputText value="#{e.eventStartTime}" title="#{bundle.ViewEventTitle_eventStartTime}">
				<f:convertDateTime timeZone="GMT+1" pattern="hh:mm a" />
			    </h:outputText>
			    <p>#{e.eventCity}</p>
			    <p>#{e.userEmail.userFirstName} #{e.userEmail.userLastName}</p>
			</div>
		    </ui:repeat>
		</div>
                
                
	    </p:layoutUnit>
	    <p:layoutUnit position="south" size="80" resizable="false" closable="false" collapsible="false">
		<ui:include src="/includes/footer.xhtml"/>
	    </p:layoutUnit>
        </p:layout>
    </h:body>
</html>

